package com.xveshe.admin.service.impl;

import java.util.List;

import com.xveshe.common.utils.DateUtils;
import com.xveshe.common.utils.SecurityUtils;
import com.xveshe.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xveshe.admin.mapper.XsglXsxxMapper;
import com.xveshe.admin.domain.XsglXsxx;
import com.xveshe.admin.service.IXsglXsxxService;

/**
 * 学社信息Service业务层处理
 *
 * @author 葛亚松
 * @date 2024-11-01
 */
@Service
public class XsglXsxxServiceImpl implements IXsglXsxxService
{
    @Autowired
    private XsglXsxxMapper xsglXsxxMapper;

    /**
     * 查询学社信息
     *
     * @param id 学社信息主键
     * @return 学社信息
     */
    @Override
    public XsglXsxx selectXsglXsxxById(String id)
    {
        return xsglXsxxMapper.selectXsglXsxxById(id);
    }

    /**
     * 查询学社信息列表
     *
     * @param xsglXsxx 学社信息
     * @return 学社信息
     */
    @Override
    public List<XsglXsxx> selectXsglXsxxList(XsglXsxx xsglXsxx)
    {
        return xsglXsxxMapper.selectXsglXsxxList(xsglXsxx);
    }

    /**
     * 新增学社信息
     *
     * @param xsglXsxx 学社信息
     * @return 结果
     */
    @Override
    public int insertXsglXsxx(XsglXsxx xsglXsxx)
    {
        xsglXsxx.setId(UUID.randomUUID().toString());
        xsglXsxx.setCreator(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglXsxx.setCreatedate(DateUtils.getNowDate());
        return xsglXsxxMapper.insertXsglXsxx(xsglXsxx);
    }

    /**
     * 修改学社信息
     *
     * @param xsglXsxx 学社信息
     * @return 结果
     */
    @Override
    public int updateXsglXsxx(XsglXsxx xsglXsxx)
    {
        xsglXsxx.setLastmodifier(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglXsxx.setLastmodifieddate(DateUtils.getNowDate());
        return xsglXsxxMapper.updateXsglXsxx(xsglXsxx);
    }

    /**
     * 批量删除学社信息
     *
     * @param ids 需要删除的学社信息主键
     * @return 结果
     */
    @Override
    public int deleteXsglXsxxByIds(String[] ids)
    {
        return xsglXsxxMapper.deleteXsglXsxxByIds(ids);
    }

    /**
     * 删除学社信息信息
     *
     * @param id 学社信息主键
     * @return 结果
     */
    @Override
    public int deleteXsglXsxxById(String id)
    {
        return xsglXsxxMapper.deleteXsglXsxxById(id);
    }
}
